package top.shen33.yang.base;

public class R {

    private int code;
    private String msg;
    private Object data;




    public static R ok(String msg){

        R r=new R();
        r.setCode(0);
        r.setMsg(msg);
        r.setData(null);

        return r;
    }
    public static R ok(){

        R r=new R();
        r.setCode(0);
        r.setMsg("success");
        r.setData(null);

        return r;
    }


    public static R ok(String msg,Object obj){

        R r=new R();
        r.setCode(0);
        r.setMsg(msg);
        r.setData(obj);

        return r;
    }

    public static R ok(Object obj){

        R r=new R();
        r.setCode(0);
        r.setMsg("ok");
        r.setData(obj);

        return r;
    }



    public static R err(Object obj){

        R r=new R();
        r.setCode(-1);
        r.setMsg("error");
        r.setData(obj);

        return r;
    }
    public static R err(String msg){

        R r=new R();
        r.setCode(-1);
        r.setMsg(msg);
        r.setData(null);

        return r;
    }
    public static R err(){

        R r=new R();
        r.setCode(-1);
        r.setMsg("failure");
        r.setData(null);

        return r;
    }
    public static R err(String msg,Object data){

        R r=new R();
        r.setCode(-1);
        r.setMsg(msg);
        r.setData(data);

        return r;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


}
